package com.briup.estore.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.Query;
import com.briup.estore.entity.vo.CollectVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.briup.estore.common.utils.PageUtils;

import com.briup.estore.dao.CollectDao;
import com.briup.estore.entity.CollectEntity;
import com.briup.estore.service.CollectService;


@Service("collectService")
public class CollectServiceImpl extends ServiceImpl<CollectDao, CollectEntity> implements CollectService {
@Autowired
private CollectDao collectDao;

    @Override
    public boolean findCollectByUser(Long userId, Long shopId) {
        CollectEntity entity = collectDao.selectOne(new QueryWrapper<CollectEntity>().eq("shop_id", shopId).eq("user_id", userId));
        return entity==null?false:true;
    }

    @Override
    public List<CollectVO> findCollectByUser(Long userId) {
        List<CollectVO> list = collectDao.findUserCollects(userId);
        return list;
    }
}